package com.demo.common.model;

import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
/**
 * Blog model.

将表结构放在此，消除记忆负担
mysql> desc blog;
+--------------+--------------+------+-----+---------+----------------+
| Field        | Type         | Null | Key | Default | Extra          |
+--------------+--------------+------+-----+---------+----------------+
| id           | int(11)      | NO   | PRI | NULL    | auto_increment |
| title        | varchar(200) | NO   |     | NULL    |                |
| content      | text         | NO   |     | NULL    |                |
| publishTime  | datetime     | NO   |     | NULL    |                |
+---------+--------------+------+-----+---------+---------------------+

 */
public class Blog extends Model<Blog> {
	public static final Blog me = new Blog();

	/**
	 * 所有 sql 写在 Model 或 Service 中，不要写在 Controller 中,利于维护
	 */
	public Page<Blog> paginate(int pageNumber, int pageSize) {
		return paginate(pageNumber, pageSize, "select *", "from blog order by id asc");
	}
}